<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="../node_modules/jquery/dist/jquery.js"></script>
</head>
<body>

<img src="https://img.alicdn.com/tps/i4/TB1RelGhTM11u4jSZPxtKahcXXa.gif" alt="">



<script>
    /**
    //等待图片加载完
    window.onload = function (ev) {
        var img = document.getElementsByTagName("img")[0];
        console.log(img.width);//290
        var width = window.getComputedStyle(img).width;
        console.log(width);//290px
    }
    //不会等待图片加载完
    $(()=>{
        var $img = $("img")[0];
        console.log($img.width);
    });**/
    /**
    //后面的函数会覆盖掉前面的函数
    window.onload = (ev)=>{
        alert(1)
    };
    window.onload = (ev)=>{
        alert(2)
    };
    //后面的函数不会封盖前面的函数，而是两个函数同时执行了
    $(()=>{
        alert(1)
    });
    $(()=>{
        alert(2)
    });**/


</script>

</body>
</html>